package org.lalib.entity.object.variable;

import org.lalib.entity.object.EBaseEntity;
import org.lalib.entity.object.ECategory;
import org.lalib.entity.object.EHistoricalValue;

public abstract class EVariable extends EBaseEntity {

	private static final long serialVersionUID = 1L;

	private String name;
	private String label;
	private String description;
	private String tabName;
	@SuppressWarnings("unused")
	private String type;

	private ECategory category;
	private boolean required = false;

	public abstract String getType();

	public abstract Class<?> getVariableClass();

	public abstract Object getEmptyCore();

	@SuppressWarnings({ "rawtypes", "unchecked" })
	public EHistoricalValue initVariable() {
		EHistoricalValue eHistoricalValue = new EHistoricalValue();
		eHistoricalValue.setCore(getEmptyCore());
		eHistoricalValue.setVariable(this);
		return eHistoricalValue;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public ECategory getCategory() {
		return category;
	}

	public void setCategory(ECategory category) {
		this.category = category;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public boolean isRequired() {
		return required;
	}

	public void setRequired(boolean required) {
		this.required = required;
	}

	public String getTabName() {
		return tabName;
	}

	public void setTabName(String tabName) {
		this.tabName = tabName;
	}

	public void setType(String type) {
		this.type = type;
	}
}